package cn.gameo2o.controller.plgl;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.gameo2o.pojo.O2o_commentmanage;
import cn.gameo2o.service.plgl.PingLunGuanLiService;
import cn.gameo2o.util.PageParam;

/**
 * 评论管理controller
 * @author 王丹丹
 *
 */
@RestController
@RequestMapping("/plgl")
public class PingLunGuanLiController {
	@Resource
	private PingLunGuanLiService plService;

	public PingLunGuanLiService getPlService() {
		return plService;
	}

	public void setPlService(PingLunGuanLiService plService) {
		this.plService = plService;
	}
	@RequestMapping("/findAll")
	public PageParam findAll(@RequestParam(required=false)String name,@RequestParam(required=false)String states,@RequestParam(required=false)Date time,@RequestParam(required=false)Integer userid,@RequestParam() Integer pageSize,@RequestParam() Integer first){
		Map params=new HashMap();
		params.put("name", name);
		params.put("states",states);
		params.put("time",time);
		params.put("userId", userid);
		PageParam page=new PageParam();
		page.setPageSize(pageSize);
		page.setFirst(first);
		plService.findPl(params, page);
		return page;
	}
	@RequestMapping("/findbyid")
	public O2o_commentmanage findbyid(@RequestParam()String id){
		return plService.findPlById(Integer.parseInt(id))	;
	}
	@RequestMapping("/delete")
	public String delete(@RequestParam()String id){
		plService.deletePl(Integer.parseInt(id));
		return "删除成功";
	}
}
